#ifndef CWINDOW_H
#define CWINDOW_H

#include "CTopWidget.h"
#include "CWindowBar.h"

#include <QStatusBar>

class CWindow : public CTopWidget {
    Q_OBJECT
public:
    explicit CWindow(QWidget *parent = nullptr);
    ~CWindow();

    void reloadStrings();

private:
    void init();

public:
    QMenuBar *menuBar() const;
    void setMenuBar(QMenuBar *menuBar);

    QStatusBar *statusBar() const;
    void setStatusBar(QStatusBar *statusBar);

    inline void setCentralWidget(QWidget *widget) {
        setWidget(widget);
    }
    inline QWidget *centralWidget() const {
        return m_widget;
    }

private:
    CWindowBar *m_titleBar;
    QStatusBar *m_statusBar;

    void handleMinimize();
    void handleMaximize();
    void handleClose();

protected:
    bool isMouseOnCaption() const override;
    bool isNative() const override;
    void setNative(bool value) override;

    void windowTitleChangeEvent(QEvent *event) override;

    void changeEvent(QEvent *event) override;
};

#endif // CWINDOW_H
